Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor climdex.r into modular R scripts #36

Merged
merged 84 commits into from
Oct 9, 2024

Conversation

QSparks
Copy link
Contributor

@QSparks QSparks commented Sep 17, 2024

Summary

This PR refactors the original climdex.R file by breaking it into multiple smaller, focused R scripts.
There are no changes to the functionality; this is purely an organizational refactor.
R CMD check runs without errors, warnings, or notes and all tests pass.

Changes Made

  1. Refactoring into Modular Scripts:

    • The code has been divided into several scripts based on functionality and were organized according to this comment:
      • climdexInput_class.R: Contains the definition of the climdexInput class and its associated methods, and validation routines.
      • precipitation_indices.R
      • temperature_indices.R
      • threshold_indices.R
      • date_utils.R
      • series_utils.R
      • stats_utils.R
      • threshold_utils.R
  2. Documentation Updates

    • DESCRIPTION File:

      • Added Encoding: UTF-8 to handle ✖ roxygen2 requires "Encoding: UTF-8" error
      • Addstats and utils to imports to handle errors such as: no visible global function definition for ‘read.csv’
      • Added Roxygen: list(markdown = TRUE) and updated RoxygenNote to version 7.3.2.
    • climdex.pcic-package.R:

      • Add .registration = TRUE to the @useDynLib tag so that roxygen2 would add it the namespace.
      • Updated deprecated @docType "package" to _PACKAGE.
      • Ensured that roxygen2 Generates Correct Namespace:
      • Created with roxygen2::roxygenize(clean=T)

      resolves: Refactor Climdex.r into Submodules #35

This commit adds the 'as.df' parameter to relevant functions, allowing users to choose whether results should be returned as data frames, including the exact date, or start and end dates of climate extremes. Additionally, utility functions like 'ymd.dates' and 'exact.date' are introduced for date handling.
@QSparks QSparks force-pushed the release/1.2-0-seasonal-and-exact-date-features branch from f9f4e92 to 69f5750 Compare October 7, 2024 19:54
@QSparks QSparks changed the base branch from release/1.2-0-seasonal-and-exact-date-features to master October 9, 2024 20:11
@QSparks QSparks merged commit d82bcfe into master Oct 9, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor Climdex.r into Submodules
2 participants